Telegram Group & Telegram Channel
Как понять хешируемый ли объект?


1️⃣ Объект должен иметь метод `__hash__()`, который возвращает целое число — это и есть хеш объекта.

2️⃣ Хеш-значение не должно меняться в течение жизни объекта. Это важно, чтобы объект можно было использовать как ключ в словарях или элемент в множествах.

3️⃣Объект должен поддерживать сравнение через `__eq__()`. Если два объекта равны (по ==), они обязаны иметь одинаковый хеш.

Простое правило:
— Неизменяемые объекты в Python (например, int, float, str, tuple, frozenset) — хешируемы.
— Изменяемые объекты (например,
list, dict, set) — не хешируемы.

Библиотека собеса по Python
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/py_interview_lib/795
Create:
Last Update:

Как понять хешируемый ли объект?


1️⃣ Объект должен иметь метод `__hash__()`, который возвращает целое число — это и есть хеш объекта.

2️⃣ Хеш-значение не должно меняться в течение жизни объекта. Это важно, чтобы объект можно было использовать как ключ в словарях или элемент в множествах.

3️⃣Объект должен поддерживать сравнение через `__eq__()`. Если два объекта равны (по ==), они обязаны иметь одинаковый хеш.

Простое правило:
— Неизменяемые объекты в Python (например, int, float, str, tuple, frozenset) — хешируемы.
— Изменяемые объекты (например,
list, dict, set) — не хешируемы.

Библиотека собеса по Python

BY Библиотека собеса по Python | вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/py_interview_lib/795

View MORE
Open in Telegram


Библиотека собеса по Python | вопросы с собеседований Telegram | DID YOU KNOW?

Date: |

Find Channels On Telegram?

Telegram is an aspiring new messaging app that’s taking the world by storm. The app is free, fast, and claims to be one of the safest messengers around. It allows people to connect easily, without any boundaries.You can use channels on Telegram, which are similar to Facebook pages. If you’re wondering how to find channels on Telegram, you’re in the right place. Keep reading and you’ll find out how. Also, you’ll learn more about channels, creating channels yourself, and the difference between private and public Telegram channels.

That strategy is the acquisition of a value-priced company by a growth company. Using the growth company's higher-priced stock for the acquisition can produce outsized revenue and earnings growth. Even better is the use of cash, particularly in a growth period when financial aggressiveness is accepted and even positively viewed.he key public rationale behind this strategy is synergy - the 1+1=3 view. In many cases, synergy does occur and is valuable. However, in other cases, particularly as the strategy gains popularity, it doesn't. Joining two different organizations, workforces and cultures is a challenge. Simply putting two separate organizations together necessarily creates disruptions and conflicts that can undermine both operations.

Библиотека собеса по Python | вопросы с собеседований from ru


Telegram Библиотека собеса по Python | вопросы с собеседований
FROM USA